Skip to content

Reimplement UpdateChild, UpdateWheatFarmer, UpdateCrossbowman, UpdateLadderman, UpdateTunneler and UpdateFireThrower from gynt's units branch, under /GL (100%) - #516

Merged
gynt merged 7 commits into
sourcehold:mainfrom
kotijekriv:reimpl/units-A-round8-100
Nov 29, 2026

Conversation

@kotijekriv

Copy link
Copy Markdown
Contributor

Six more Map::Units update functions, from gynt's units branch reimpl/map-units-updatefunctions (his draft #204). We had them at 100% on our development branches on top of #378 before it merged; these are the same statements on main 859c1fe (which now has #238's UnitsState functions and #511's TribesState functions under /GL), after one text pass (BOOLEnum calls tested by truthiness, enum names for state numbers, casts that change nothing dropped, const on locals, comments without addresses; each commit lists its own). Each reads 100.0% in the default build with its own line in cmake/compiler-flags-gl.txt. Each commit cites gynt's commits on the file and our steps on it, and credits him as co-author. No header change and no change to cmake/function-visibility.txt.

Function Address Before After
Units::UpdateChild 0x005477C0 gynt's draft 27.32% (948147d) 100.0%, under /GL; 47.3% with OPENSHC_FUNCTION_VISIBILITY_UNITS on
Units::UpdateWheatFarmer 0x005521D0 gynt's draft 24.52% (98423cb) 100.0%, under /GL; 37.7% with the option on
Units::UpdateCrossbowman 0x0055C7B0 gynt's draft 40.98% (21fe19a) 100.0%, under /GL; 62.5% with the option on
Units::UpdateLadderman 0x00563910 gynt's draft 37.35% (3631a97) 100.0%, under /GL; 47.2% with the option on
Units::UpdateTunneler 0x0054E6C0 gynt's draft 42.20% (5a1c78e) 100.0%, under /GL; 59.6% with the option on
Units::UpdateFireThrower 0x005769F0 gynt's draft 47.02% (141a491) 100.0%, under /GL; 64.0% with the option on

One more commit updates two status lines on main. Since #238 put more UnitsState files under /GL, UpdateDairyFarmer (#513) reads 93.9% instead of 85.2% in the default build, and UpdateEngineer (#514) 85.0% instead of 81.8%. Both numbers come from the full builds below, of this branch and of main. With the option on, both still read 100.0%. UpdatePitchman's 94.1% doesn't change.

Measured.

  • Setup: the bundled MSVC1400-SP1 against the Steam Stronghold Crusader.exe (3bb0a8c1…5387ac5a), both resolver sets enabled locally (not committed), and sourcehold's reccmp (a86aceb03) with --resolve-wrapped-calls --ignore-security-cookie.
  • Full builds, both modes: every .cpp of this branch (main 859c1fe plus the six files), all function and data resolvers on, built once with the option off and once with it on, 0 failures, 3,011 functions each. Against builds of main 859c1fe made the same way (3,005 functions):
  • Small builds, both modes, one merge earlier: main 4ddb41a (before Reimplement UpdatePitchman and UpdateEngineer from gynt's units branch, 100% with OPENSHC_FUNCTION_VISIBILITY_UNITS on #514 and Reimplement UpdateDairyFarmer from gynt's units branch (100% with OPENSHC_FUNCTION_VISIBILITY_UNITS on) #513) with the six files and their /GL lines, their callees, every /GL file of main and every file of a function-visibility group that touches them: 468 files, 478 functions, 0 failures in both modes. All six read 100.0% / 100.0% (normalised) with the option off; with it on they read as in the full build (below; UpdateWheatFarmer 37.8% there, 37.7% in the full build).
  • Text pass, before those builds: quick_diff gives the same listing for each file before and after. One edit we tried changed it and is not in: UpdateWheatFarmer's idle local read twice from DAT_UnitHasBecomeIdle (main's UpdateHopsFarmer form); the local stays, with a comment.
  • Review pass after the full builds: the edits listed under "Kept as they are" and "Header follow-ups" (one name, storage as main's UpdateHopsFarmer and UpdateDairyFarmer have it, for UpdateWheatFarmer's two lookups of the wheat store, UpdateTunneler's shared states through state.generic as main's unit functions store them, UpdateChild's random stores in one form and its found as a BOOLEnum, > 11 * 11 in UpdateFireThrower, and one-line comments). quick_diff gives the same listing for each file before and after; the edits that changed it are not in, and the code they were about has a comment instead. A small build of this branch with the option off (471 files, 481 functions, 0 failures) reads all six at 100.0% / 100.0%. After it, only two comments were reworded and the wheat store's local renamed.
  • Checks: openshc-pr-fix finds nothing to change, and openshc-pr-check gives 159 notes, all of the kinds below, and two errors: the status lines of UpdateDairyFarmer and UpdateEngineer, whose commit changes no .cpp (the paragraph under the table).
  • Not run in game.

With OPENSHC_FUNCTION_VISIBILITY_UNITS on

None of the six has an entry in cmake/function-visibility.txt. In that mode the callees the units' wrapper holds leave the /GL list, so these units can't see them and read lower: UpdateChild 47.3% / 46.5%, UpdateWheatFarmer 37.7% / 35.9%, UpdateCrossbowman 62.5% / 53.6%, UpdateLadderman 47.2% / 34.9%, UpdateTunneler 59.6% / 56.3%, UpdateFireThrower 64.0% / 60.6%. Main's UpdatePriest, a /GL unit without an entry too, does the same in main's full builds (100.0% off, 72.0% / 68.9% on). Entries that name each unit's whole /GL callee closure are left for a follow-up, with their own full build in that mode.

The goto in UpdateTunneler

State 9's failed setDestinationForUnit and the collapse state end in the same six statements (the rubble flag, destroyBuilding of the workplace, two toggles, animationCycleNumber = 0, ULS_REMOVE). The original has them once, in the collapse state, and state 9 jumps there. Written out twice, the compiler merges the copies into the same code, but the second copy still takes its turn when the argument registers are handed out, so the registers of the calls around it come out in another order: with the tail written out in state 9 the function read 98.2% / 80.0% in our build on the development branch, with the goto removeTunnelAndUnit; 100.0% / 100.0% in the same build. The goto has a one-line comment, and the collapse block's int tile is declared without a value and set in the next line, since a jump must not pass an initialiser.

Kept as they are

  • Ternaries (14): Child 5, WheatFarmer 2, Crossbowman 2, Ladderman 1, Tunneler 2, FireThrower 2. The original computes each without a branch (setcc, sbb); an if / else gives a branch. Each has a one-line comment; the style-lint bot will still list the nine whose ? line also holds a ::.
  • Locals declared without a value, each with a one-line comment: UpdateChild's one loop counter i for all its loops and one short random for the states that draw a random number (the original keeps each in a single stack slot), UpdateTunneler's collapse tile (the goto above) and its damage, UpdateCrossbowman's damage, UpdateFireThrower's building, damage and target coordinates (set in each arm that follows). UpdateChild's loops therefore assign the shared counter instead of declaring one, and its state 17 reads the counter after its search loop, which breaks on the unit it found (the counter's comment says so).
  • Locals the match keeps: UpdateWheatFarmer's idle (above); UpdateTunneler's unitID, used where the original keeps the slot in a register while the rest reads the slot global (as UpdateCamel in Reimplement UpdateCamel, UpdateLady, UpdateMother and UpdateFireEater from gynt's units branch, under /GL (100%) #515); UpdateCrossbowman's building, read from targetID_OR_targetBuildingID in front of the state switch as the original does, and set again from the tile in the wall attack. Four more read a value again where another local already holds it, because the original loads it again there (with the other local instead, quick_diff gives another listing; each has a one-line comment): attacker (the unit's owner, read again in the wall attack of UpdateCrossbowman, UpdateFireThrower and UpdateTunneler), UpdateWheatFarmer's workplace (the farm, read again after the store calls), and UpdateTunneler's tribe, read in front of the call in its move state although it is used once, after it.
  • (char) on engineerManningSiegeStateRef_checkType (UpdateChild twice, UpdateCrossbowman twice, UpdateLadderman twice, UpdateTunneler once, UpdateFireThrower twice): the field holds the fade step that is added to the char fade countdown, so the tests read it signed. It is a byte in the header (as in Reimplement UpdateCamel, UpdateLady, UpdateMother and UpdateFireEater from gynt's units branch, under /GL (100%) #515).
  • (int) on mapTimeInTicks + slot in UpdateCrossbowman and UpdateFireThrower: mapTimeInTicks is unsigned, and the cast makes the % 40 signed, as the original computes it.
  • (short) stores: the slot and index stores (= (short)DAT_CurrentUnitSlotID::instance, (short)i, (short)storage, (short)leader), the match-time store (short)mapTimeInTicks, as main's unit functions write them. UpdateChild's five random updateTickTracker stores now share one form, without a cast.
  • Numbers without a name yet: (UnitState)17 and (UnitState)18 in UpdateChild, (UnitState)123 in UpdateCrossbowman and UpdateFireThrower, case 103 in UpdateLadderman, (EntityType)25 in UpdateCrossbowman: main's enums have no value for them (header follow-ups below). UpdateChild's numbered case labels switch on a random number (% 25).
  • US_CLIMBING_LADDER for state 104 in UpdateCrossbowman and UpdateFireThrower, by the field's type (UnitState), although main's UpdateAssassin still writes (UnitState)104.
  • BOOLEnum and bool fields tested by truthiness, other fields compared with 0: animationCycleNumberHasJustIncremented, IsGateOrTowerArray and isMatchingSpeed by truthiness; the short counters and flags (isDisappearingUnk, goToRallyPoint, movementRunUpTime, moveInstructionSpeedDelayTracker) and the undefined4 DAT_UnitHasBecomeIdle compared with 0, as main does. UpdateChild's found is a BOOLEnum local (TRUE / FALSE, tested by truthiness, as main's AICState functions write theirs), its home == 0 a building index. The checker sees files doing both.
  • field_0x58 = 0 / = 1: the checker's BOOLEnum hint comes from another struct's field_0x58 (SoundEffectsHelperData1); Unit::field_0x58 is a short, and main's UpdateHopsFarmer stores 1 and 0 into it too.
  • Tests the original writes its own way, each with a one-line comment (merged or turned round, quick_diff gives another listing): UpdateFireThrower's reload state tests frame > 0 twice in a row, and its fire state compares target > -1 where its aim state has target >= 0.
  • Arms the original keeps although they look redundant, each with a one-line comment: the > 432 arm behind the > 400 test in UpdateCrossbowman's state 0 and UpdateFireThrower's state 0 can never be true, and the original tests it anyway; the last three arms of UpdateCrossbowman's walk-speed block store the same two values, and the original keeps them apart.
  • The checker's other notes are Ghidra's placeholder field names. For three of them the code says what they hold (header follow-ups below); for the rest (field_0x3f4, field_0x2ac, the frame tables field_0x7cbc and on) we have nothing better yet.

Differences from the draft

None that reads a test the other way. We compared the go-home tests (UpdateChild's fifteen someCount46 == 0 tests read as in the draft) and the target and distance tests of UpdateCrossbowman and UpdateFireThrower: where ours is written the other way round (target > -1 as target >= 0, < 161 as <= 160, target < 0 with its arms swapped), it means the same.

Header follow-ups

Each of these is a header that functions on main use, so it goes in a PR of its own, with full builds of main's users in both modes (#515 left the first two the same way):

  • DAT_UnitHasBecomeIdle holds only 0 and 1: as a BOOLEnum, every use in these files would store TRUE / FALSE and test by truthiness.
  • Unit::engineerManningSiegeStateRef_checkType holds a signed fade step: as a char, the nine (char) casts here go, and UpdateChild's store of 255 becomes -1.
  • UnitState has no values 17, 18, 103 and 123 (US_UNKNOWN_17, US_UNKNOWN_18, US_UNKNOWN_103, US_UNKNOWN_123), and EntityType none for 25 (ET_UNKNOWN_25, UpdateCrossbowman's projectile when it shoots at no unit).
  • Three placeholder fields the code explains: field_0x11c74 (UnitPropertiesDefinedData) is a table of x / y tile offsets around a unit (UpdateChild's play states); Unit::field_0x2c4 holds a UnitState (UpdateCrossbowman and UpdateFireThrower compare it with 123 before they store state 123); Unit::field_0x3f8 is a 0 / 1 flag.

Names on main these files show (follow-ups, not changed here)

  • Unit::jugglerCount is the crossbowman's aim pitch: -1, 0 or 1 picks the frame table (UpdateCrossbowman's aim and fire states).
  • Building::farmGrowState holds the wheat farmer's next state (3, 5, 6 or 8, stored as his state).
  • PlayerData::countFireThrowers (0x2A3C) is the fire throwers' rally counter; it differs from countFirethrowers (0x20F8), the head count, only in case.
  • checkIfCitizenUnitIsAliveBasedOnState reads inverted: it is true when the unit is dying (the callers then play the death or the disappear state).
  • PlayerData::childTargetIDUnk holds the slot of the child that leads the others.
  • UpdateTunneler's four idle frame tables (field_0x42c4 to field_0x43b4, 0x50 apart, picked by substate) could be one array.

Other PRs

  • gynt's Reimpl/map units updatefunctions #204 holds these files too. Once this lands, his branch can take main's version of them.
  • This PR adds its six lines at the end of cmake/compiler-flags-gl.txt; another PR that does the same gets a one-line conflict there: keep all the lines.
  • Main 859c1fe still has the 12 files that don't compile since Reimplement 59 TextManager and UserTextHandler functions at 100% #509's sync (renderDebugDataCurrentPlayerData, applyGateOrDrawbridgeOpenCloseChange, initializeGatePathfindingForOwner, updatePathLinkageTileMap, UpdateGateHouseLarge, UpdateGateHouseSmall, UpdateWoodGate1, findBestAttackTileByPathCost, resetTileAndClearMoat, GateOpenOrClose, ClickOpenOrCloseGate, TransformAndRenderPercentage). All the builds above left them out, with their resolvers off. This PR doesn't touch them.

🤖 Generated with Claude Code

kotijekriv and others added 7 commits November 29, 2026 16:50
Units::UpdateChild at 100%, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his draft
PR 204; his commits on the file: 06ebdf6 at 25.50% and the style commit 948147d at 27.32%, then
974c32f's clang-format), through the forms on our development branches. The statements are his; what the text
needed is how they are arranged and where three values live. Nothing behaves differently from the draft.

1. The fifteen "stay at home while enemies are around" tests as nested ifs with an early return in each arm:
   `if (mode != skirmish) { if (sumOfTotalEnemyUnitsCount != 0) {go home} } else if (someCount46 == 0) {go home}`.
   A combined condition compiles to setcc, where the original branches (0x0054792C .. 0x00547954 and fourteen
   more). The draft's polarity was already the original's.
2. One function-level `int i;` for every loop, and one `short random;` for the RNG value in states 15, 16 and 18.
   The compiler orders its stack slots by use count: the original keeps the loop counter in one slot
   ([esp + 0x10] at 0x0054823A, 0x005487BB and 0x00548B56) and the RNG value in one ([esp + 0x1c] at 0x00548744
   and 0x00548A3A); with a variable per loop and per state the slots come out in another order.
3. `random` is a short because the original divides it with idiv (state 15: idiv esi at 0x00548A47 and
   0x00548A5B). `v % 7` of an int variable compiles to a multiply by the inverse; of a short (promoted) or of a
   global read it divides. For the same reason state 0 switches on `SEC_RNG::instance.currentNumber2 % 25`
   (cdq / idiv at 0x0054795F / 0x00547965). State 18 takes its two offsets from `random` too: the original loads
   the lord's coordinates in front of each division and keeps the lord in a stack slot (0x00548D2C).
4. State 0's switch cases end in `break;` and the one nextRandomNumber2() after the switch serves them all (the
   original's cases end in their own jumps to it, 0x005479A4 .. 0x00547AA3; a call and a return in each case
   gave other epilogues).
5. The states after state 16 as one else-if chain without the returns that closed them, the alive check, the
   disappear state and the fallback in its final else. States 14 and 15 then jump forward into state 18's
   `destinationNeeded = 1; return` (0x005489BF, 0x00548AF5 -> 0x00548DF4) as in the original, which keeps the
   later copy of a tail the states share; with the returns the compiler kept the first.
6. Smaller arrangements: state 16's `found` flag set to FALSE in front of the destination test ([esp + 0x20] at
   0x00548759), its gfxNumber written in both arms of the frame test, the play rounds stored to this child and
   then copied to the other one (lea eax, [edx + 1] at 0x00547DBB and 0x005482EA), and state 18's three stores
   in the original's order (129, 1, 16 at 0x00548CFC .. 0x00548D0E).
7. The fade countdown without its `(char)` casts: the field is a char in main's Unit.hpp.

On main, this round's text pass: the BOOLEnum computeLadderClimbPath tested by truthiness; `(UnitState)10` and 13
to 16 as US_UNKNOWN_10 to US_UNKNOWN_16 (17 and 18 have no name yet); the `(char)` casts on the seven
Frames_Shared_UnitClimbingUp reads dropped (char in main's AnimationFrameData.hpp); `const` on owner and the home,
other, offset and leader locals; the comments on the shared loop counter, the shared random value and the five
ternaries say why without addresses; one comment on the two sign tests of the fade step; the worker-list comment
reworded; after the review, the five random updateTickTracker stores in one form without a cast, `found` as a
BOOLEnum local, and the counter's comment says that state 17 reads it after its search loop. The quick_diff listing
is the same before and after.

Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised):
a narrow build on main 4ddb41a, before sourcehold#514 and sourcehold#513 merged (468 files: main's /GL files, the six units of this
round with their callee closures, every file of a function-visibility group that touches them) and a full build of
every file of the branch on main 859c1fe (2,993 files, 3,011 functions), each once with
OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK all four. It reads 100.0 / 100.0 with the
option off in both. With it on it reads 47.3 / 46.5 in both: it has no entry in cmake/function-visibility.txt, so
the callees the units' wrapper holds leave the /GL list in that mode (main's UpdatePriest, a /GL unit without an
entry, reads 72.0 / 68.9 there for the same reason).

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Units::UpdateWheatFarmer at 100%, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his draft
PR 204; his commits on the file: 94a6fd5 at 39.73% and the style commit 98423cb at 24.52%), through the forms
on our development branches. The statements are his; what the text needed is how they are arranged:

1. The "walk to the next tile" tail (changeDestinationByAmount(slot, 1) and the two tile stores) is written out
   at the end of each of the four states that reach it, each with its own return, instead of once behind the
   else-if chain. The original has one physical copy in state 4 (0x0055265D) and the others join it at
   different depths: state 1 jumps to its start, state 7 behind its own push (0x005529EE to 0x0055265F), the
   store state behind its own two pushes (0x00552D90 to 0x00552666). Joins at different depths are separate
   copies in the source that the compiler merged.
2. What stands behind the chain is `if (DAT_UnitHasBecomeIdle != 0) { state = 110; }`, shared by the two death
   animations (state 111 and the alive check): both end in `gfx = frame + N;` and fall out of the chain. The
   original's join stands behind the alive check's block (0x00552EC1) and state 111 jumps forward into it
   (0x00552E5B). With one idle test per block the compiler kept the first block's copy.
3. The two walk ternaries as `index < size ? walking : arrived` (setge / and -0x80 / add 0x81).
4. State 8: the DamageLayer store written first (the tile index is loaded in front of the unit's stores).
5. Taking goods to the store: the walk tail in the if of a successful setDestinationForUnit, the failure
   behind it.

On main, this round's text pass: the BOOLEnum isFarmTileReadyForWheatStageChange tested by truthiness (four
places); the shared states by their UnitState names (US_DISAPPEAR, US_UNKNOWN_121, US_UNKNOWN_108, US_DEATH_01),
with US_DISAPPEAR stored through state.generic as the file's other shared states; the farm's grow state stored
through state.generic without a cast, as main's UpdateHopsFarmer does; the `(short)` casts on
`farmerDestinationTile - addXgetTile` and on DirectionAlgorithmState's orientation dropped; the `(char)` casts on
the six frame-table reads dropped; `const` on the locals; one comment on `idle` (read once: with two global reads
the listing changes); the two ternary comments without addresses; after the review, the two lookups of the wheat
store under one name (`storage`, as main's UpdateHopsFarmer and UpdateDairyFarmer name it), and a comment on the second read of the workplace (with `farm` instead, the listing changes). The
quick_diff listing is the same before and after.

Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised):
a narrow build on main 4ddb41a, before sourcehold#514 and sourcehold#513 merged (468 files: main's /GL files, the six units of this
round with their callee closures, every file of a function-visibility group that touches them) and a full build of
every file of the branch on main 859c1fe (2,993 files, 3,011 functions), each once with
OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK all four. It reads 100.0 / 100.0 with the
option off in both. With it on it reads 37.8 / 35.9 in the narrow build and 37.7 / 35.9 in the full one: it has no
entry in cmake/function-visibility.txt, so the callees the units' wrapper holds leave the /GL list in that mode
(main's UpdatePriest, a /GL unit without an entry, reads 72.0 / 68.9 there for the same reason).

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Units::UpdateCrossbowman at 100%, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his draft
PR 204; his commits on the file: 43f68e4 at 31.63% and the style commit 21fe19a at 40.98%), through the forms
on our development branches. The statements are his; what the text needed is how they are arranged:

1. Every access reads the unit through DAT_CurrentUnitSlotID::instance; the draft's local copy `int unitID` is
   gone.
2. State 0's end is one if / else chain with a single return behind it: the shoot-or-not code stands in the
   first arm and behind the second acquireShootTarget. The original keeps the later copy (0x0055C978) and the
   first arm jumps forward into it (0x0055C921). With early returns our compiler keeps the first copy.
3. The move states' and the appear state's walk-speed block in the original's form: the delayed arm first, the
   sheet store in every arm, one arm per reason to stand still.
4. Gathering at the rally point: `((int)mapTimeInTicks + slot) % 40`, the state store written in front of the
   counter.
5. `int building = targetID_OR_targetBuildingID;` in front of the switch (movsx ebx at 0x0055C833, between the
   switch's compare and its jump).
6. The wall-attack state in the form that matched in UpdateFireThrower; the damage is
   `!isGateOrTower ? 4 : 2` (sete at 0x0055CE00).
7. The shoot target as an int local where the original sign-extends it once and tests the register; the aim
   compare is `target >= 0`.
8. The idle state's two frame tables: the `(fixedRng & 1) != 0` arm first.
9. Three height sums as `terrain + building`. quick_diff cannot see this (it folds every displacement).
10. The fade countdown is stepped with -- on the char field (a char in main's Unit.hpp).

On main, this round's text pass: the BOOLEnum moveUnitToBehaviorTarget tested by truthiness (two places);
`LogicLayer & 256` as LogicHelpers::L_WALL_OR_GATEHOUSE and the `(short)` on BuildingLayer dropped;
`(UnitState)105` and 104 as US_RALLYING and US_CLIMBING_LADDER (123 has no name yet); the BOOLEnum array read as
`!IsGateOrTowerArray[...]` instead of `== FALSE`; the `(char)` casts on the 17 frame-table reads dropped; `const`
on the locals; the two ternary comments without addresses, one comment on `building` (read before the switch) and
one on `damage`; the TODO on the AttackInfo blocks dropped (main models them now); after the review, comments on
the `> 432` arm that can never be true, on the walk-speed arms that store the same values, and on the owner read in
the wall attack (with `owner` instead, the listing changes). The quick_diff listing is the same before and after.

Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised):
a narrow build on main 4ddb41a, before sourcehold#514 and sourcehold#513 merged (468 files: main's /GL files, the six units of this
round with their callee closures, every file of a function-visibility group that touches them) and a full build of
every file of the branch on main 859c1fe (2,993 files, 3,011 functions), each once with
OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK all four. It reads 100.0 / 100.0 with the
option off in both. With it on it reads 62.5 / 53.6 in both: it has no entry in cmake/function-visibility.txt, so
the callees the units' wrapper holds leave the /GL list in that mode (main's UpdatePriest, a /GL unit without an
entry, reads 72.0 / 68.9 there for the same reason).

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Units::UpdateLadderman at 100%, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his draft PR
204; his commits on the file: 01cf3a2 at 22.89%, afda7ec at 37.19% and the style commit 3631a97 at
37.35%), through the forms on our development branches. The statements are his; what the text needed is how they
are arranged:

1. The walk-speed block, three times (move to destination, appear, walking to the wall), as the original lays
   it out: the delayed arm first and the sheet store in every arm:
       if (delay != 0) { sheet = 1; if (delay > 70) { speed = -1; f30 = 0; } else { speed = 0; } }
       else if (runUp != 0) { sheet = 1; speed = 0; }
       else if (isMatchingSpeed != false) { sheet = 1; speed = 0; }    (move state only)
       else { sheet = 1; speed = 1; }
   Two arms with the same stores give the original's `jne A; cmp; je B; A: ...`: the compiler merges them. One
   arm on || does not (the compiler lays the arms out as for &&).
2. Every access through the global slot (no unitID local): the slot's register is ecx as in the original.
3. The fade countdown is stepped with -- on the field, a char in main's Unit.hpp. The original holds -1 in eax (or
   eax, -1 at 0x005639E4) for the substate store (0x005639E7) and this add (0x005639FE); with the field as an
   unsigned char our compiler added 255 as its own immediate.

On main, this round's text pass: `(UnitState)105` and `case 105` as US_RALLYING (103 has no name yet; the using
goes); the `(short)` on DirectionAlgorithmState's orientation and the `(char)` casts on the six frame-table reads
dropped; `const` on owner and tile; the ternary comment without its address. The quick_diff listing is the same
before and after.

Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised):
a narrow build on main 4ddb41a, before sourcehold#514 and sourcehold#513 merged (468 files: main's /GL files, the six units of this
round with their callee closures, every file of a function-visibility group that touches them) and a full build of
every file of the branch on main 859c1fe (2,993 files, 3,011 functions), each once with
OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK all four. It reads 100.0 / 100.0 with the
option off in both. With it on it reads 47.2 / 34.9 in both: it has no entry in cmake/function-visibility.txt, so
the callees the units' wrapper holds leave the /GL list in that mode (main's UpdatePriest, a /GL unit without an
entry, reads 72.0 / 68.9 there for the same reason).

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Units::UpdateTunneler, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his draft PR 204; his
commits on the file: 192307c at 35.44%, 5a1c78e at 42.20%, then 6565c1b and 974c32f for the build and
clang-format), through the forms on our development branches. It reads a true 100.0 / 100.0. The statements are
his; what the text needed is how they are arranged.

1. One copy of the removal tail. State 9's failed setDestinationForUnit and the collapse state end in the same
   six statements (rubble flag, destroyBuilding of the workplace, two toggles, cycle = 0, REMOVE). The original
   has them once, in the collapse state (0x0054EFEB), and state 9 jumps there (je at 0x0054ED95). Written twice
   the compiler merges the copies into that same code, but the second copy still takes its turn while the
   argument registers are handed out: they go eax, ecx, edx in rotation, and the original's run from 0x0054ED73
   to 0x0054EF2A has no gap (ecx edx eax / ecx / edx eax ecx / edx / eax ecx edx eax) where that copy's argument
   would stand. So state 9 says `goto removeTunnelAndUnit;`. With it the finished arm's argument is in ecx
   (0x0054EDD9) and its rubble flag is stored behind the push (0x0054EDE6), the two height calls take y / x /
   tile in edx / eax / ecx (0x0054EE45, 0x0054EE6A), the slot behind them is in edx (0x0054EE8D), and the damage
   call's four are in eax / ecx / edx / eax (0x0054EF09). The same text with the tail written out in state 9
   reads 98.2 / 80.0 in the same build. The collapse block's `int tile` is declared without a value and set in the
   next line: a jump must not pass an initialiser.
2. `int building = 0;` once at the top, and the states that need a building assign to it. With several
   definitions the variable keeps its home on the stack as in the original (store at 0x0054E702, read on the wall
   path at 0x0054F2DA).
3. The entry: `calculatedOwnerPlayerIndex = owner;` goes through the slot global and the isSelectable test
   through the local unitID. The original has the store in front of the compare (0x0054E6F5, 0x0054E6FB); with
   one index expression in both, the compiler moves the compare up.
4. The gathering state (105): one `someCount29++;` behind `if (reached) { if (find...) { set the destination }
   else { facingDirection = 4; } }`. The compiler copies that tail itself (0x0054E884 and 0x0054E8A6).
5. The move state: one arm per reason to stand still, the run arm last, and the sheet store in every arm (it
   stands between the compare and its jump at 0x0054E917 .. 0x0054E923).
6. Tunneling and collapse: the tunnel frame test is `>= 24` (cmp cx, 0x18 / jl at 0x0054EE38); the collapse
   state's damage arm comes first, `if (frame < 65) { damage } else { collapse }`, and the collapse tests
   `BuildingLayer[tile] != 0` first.
7. The wall attack's end has UpdateArabianArcher's arrangement (destroyed wall, the AI's give-up tests, one
   `cycle = 0` end).
8. The chain's last arms: `else if (checkIfCitizenUnitIsAliveBasedOnState(slot)) { death animation } else {
   disappear }` (je at 0x0054F70D to 0x0054F786).
9. Two conditional expressions where the original has no branch (setg at 0x0054E7DF, sbb at 0x0054F316); the
   fade countdown without `(char)` casts (a char in main's Unit.hpp).
10. Names: the tunneler's own states (UnitState_Tunneler, through state.tunneler) where its enum has the value;
    the states every unit shares keep the generic names (105 is US_RALLYING on main).

On main, this round's text pass: `(UnitState)105` as US_RALLYING (the using goes); the `(short)` casts on
`targetedBuildingTile - addXgetTile` and the `(char)` casts on the 12 frame-table reads dropped; `const` on unitID,
owner, state and the other locals; the comments on unitID, on the shared building variable, on the two ternaries
and on the goto without addresses or scores; the TODO on the AttackInfo blocks dropped (main models them now);
after the review, the states every unit shares stored through state.generic, as main's unit functions store them,
and comments on the owner read in the wall attack and the tribe read in the move state (each changes the listing
when replaced). The quick_diff listing is the same before and after.

Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised):
a narrow build on main 4ddb41a, before sourcehold#514 and sourcehold#513 merged (468 files: main's /GL files, the six units of this
round with their callee closures, every file of a function-visibility group that touches them) and a full build of
every file of the branch on main 859c1fe (2,993 files, 3,011 functions), each once with
OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK all four. It reads 100.0 / 100.0 with the
option off in both. With it on it reads 59.6 / 56.3 in both: it has no entry in cmake/function-visibility.txt, so
the callees the units' wrapper holds leave the /GL list in that mode (main's UpdatePriest, a /GL unit without an
entry, reads 72.0 / 68.9 there for the same reason).

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Units::UpdateFireThrower at 100%, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his draft
PR 204; his commits on the file: 0297f00 at 42.34% and the style commit 141a491 at 47.02%), through the forms
on our development branches. The statements are his; what the text needed is how they are arranged:

1. State 0's end: the shoot-or-not code (`if (state != MOVE) { state = RELOAD; ifOnADefensive...(slot); }
   return;`) written out behind each of the two acquireShootTarget calls; the original joins the two copies
   through a pointer to the state (lea at 0x00576B3C and 0x00576BA2, the join at 0x00576BA8). The cases 105,
   2 / MOVE / 123 and APPEAR are no longer nested in an if block.
2. The wall-attack state: one `cycle = 0` end behind an if / else; a failed moveUnitToBehaviorTarget only
   stores the state (the original computes the unit's offset twice there, 0x005770A5 and 0x005770AB); the two
   give-up tests each compute the danger and the tolerance themselves, the wall arm first.
3. Both walk-speed blocks in the original's form (the delayed arm first, the sheet store in every arm).
4. The fade countdown is stepped with -- on the char field (a char in main's Unit.hpp); it
   shares the -1 register with the substate store (or ecx, -1 at 0x00576A7B).
5. Gathering at the keep: `((int)mapTimeInTicks + slot) % 40` (cdq / idiv at 0x00576C21), `<= 160`, the state
   store written in front of the counter.
6. The shoot target as an int local where the original sign-extends it once and tests the register (the group
   leader's shot, the reload state); the building's half size as `widthOrHeight / 2`.
7. Three compares turned round again: aim `target >= 0`, fire `target > -1`, sit down `<= 400`.
8. Three height sums as `terrain + building`. quick_diff cannot see this (it folds every displacement); reccmp
   read 99.5 / 88.2 before it.

On main, this round's text pass: the BOOLEnum getKeepLocationForAIUnit and moveUnitToBehaviorTarget tested by
truthiness (four places); `(UnitState)105` and 104 as US_RALLYING and US_CLIMBING_LADDER (123 has no name yet); the
`(int)` on widthOrHeight dropped (an int on main); the `(char)` casts on the 12 frame-table reads dropped; `const`
on the locals; comments without addresses on the ternaries, on `building`, `damage` and the target coordinates; the
TODO on the AttackInfo blocks dropped (main models them now); after the review, `> 11 * 11` for the squared throw
distance, and comments on the `> 432` arm that can never be true, the owner read in the wall attack, the second
`frame > 0` test and the fire state's `> -1` (each changes the listing when replaced). The quick_diff listing is
the same before and after.

Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised):
a narrow build on main 4ddb41a, before sourcehold#514 and sourcehold#513 merged (468 files: main's /GL files, the six units of this
round with their callee closures, every file of a function-visibility group that touches them) and a full build of
every file of the branch on main 859c1fe (2,993 files, 3,011 functions), each once with
OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK all four. It reads 100.0 / 100.0 with the
option off in both. With it on it reads 64.0 / 60.6 in both: it has no entry in cmake/function-visibility.txt, so
the callees the units' wrapper holds leave the /GL list in that mode (main's UpdatePriest, a /GL unit without an
entry, reads 72.0 / 68.9 there for the same reason).

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lt build

Both read higher with OPENSHC_FUNCTION_VISIBILITY_UNITS off since sourcehold#238 put more
UnitsState files under /GL (for UpdateDairyFarmer, CheckUnitProductionPaused).
Measured in this branch's full builds and in builds of main 859c1fe made the
same way, both modes:

- UpdateDairyFarmer 0x00554500: 85.2% -> 93.9% / 90.0% (normalised) off,
  100.0% / 100.0% on (unchanged).
- UpdateEngineer 0x00564250: 81.8% -> 85.0% / 79.6% off, 100.0% / 100.0% on
  (unchanged).

UpdatePitchman 0x00551980 still reads 94.1% off and keeps its line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Style guide reading (advisory, posted once)

11 possible deviation(s) from REIMPLEMENTATION_STYLE_GUIDE.md across 5 of the 6 reimplemented .cpp file(s) in this PR.

The match comes first. Where the ugly form is what matched, it stays -- that is the guide's own overriding rule, and rule 21 asks for a one-line comment saying what was measured so the next reader does not retry it. This report is posted once, when the PR opens, and is not repeated on later pushes.

rule what it asks hits
20 Keep nesting low; no goto 1
23 Prefer if-else over ternary 9
24 Declare variables upon first use 1
Where

Rule 20 — Keep nesting low; no goto

  • src/OpenSHC/Map/Units/UpdateTunneler.cpp:319 — goto; check how many predecessors the target has first

Rule 23 — Prefer if-else over ternary

  • src/OpenSHC/Map/Units/UpdateChild.cpp:135 — ternary; the guide prefers extending the if-else chain
  • src/OpenSHC/Map/Units/UpdateChild.cpp:459 — ternary; the guide prefers extending the if-else chain
  • src/OpenSHC/Map/Units/UpdateChild.cpp:504 — ternary; the guide prefers extending the if-else chain
  • src/OpenSHC/Map/Units/UpdateChild.cpp:702 — ternary; the guide prefers extending the if-else chain
  • src/OpenSHC/Map/Units/UpdateChild.cpp:747 — ternary; the guide prefers extending the if-else chain
  • src/OpenSHC/Map/Units/UpdateCrossbowman.cpp:218 — ternary; the guide prefers extending the if-else chain
  • src/OpenSHC/Map/Units/UpdateFireThrower.cpp:213 — ternary; the guide prefers extending the if-else chain
  • src/OpenSHC/Map/Units/UpdateLadderman.cpp:90 — ternary; the guide prefers extending the if-else chain
  • src/OpenSHC/Map/Units/UpdateTunneler.cpp:89 — ternary; the guide prefers extending the if-else chain

Rule 24 — Declare variables upon first use

  • src/OpenSHC/Map/Units/UpdateFireThrower.cpp:304 — declare building where it is first assigned

@gynt
gynt added this pull request to the merge queue Nov 29, 2026
Merged via the queue into sourcehold:main with commit 9f559dd Nov 29, 2026
5 checks passed
kotijekriv added a commit to kotijekriv/OpenSHC that referenced this pull request Nov 30, 2026
…d#515, sourcehold#516 and sourcehold#518 (sourcehold#534)

sourcehold#515, sourcehold#516 and sourcehold#518 put twelve units on cmake/compiler-flags-gl.txt. UpdateCamel, UpdateLady and UpdateFireEater
have an entry here already and read 100.0% with OPENSHC_FUNCTION_VISIBILITY_UNITS on; the other nine have none. In
that mode the members of every group leave the /GL list, among them the helpers in the group that holds
hasUnitReachedDestination, so a /GL unit without an entry no longer sees them: the nine read 37.7% to 65.7% in main
ff7e56e's full build in that mode, the build the real builds below compare against. Each gets an entry at its
address, its callees in address order. The /GL lines stay as they are.

Each entry names only callees that are already members of the group that holds hasUnitReachedDestination, so the
nine join that group and nothing else moves: no other function leaves the /GL list, and no other function sees a
body it did not see before. The nine's other /GL callees (setDestinationForUnit, moveToFreeTileNearby,
acquireShootTarget, shootProjectile and the rest of their closures) stay opaque to them, and they read 100.0% /
100.0% that way (raw / normalised: reccmp_report.py's normalised figure ignores call and tail-jump targets and
resolver addresses). Naming each unit's whole /GL callee closure instead would put 28 more functions in that group:
with every .cpp of main as the build list, cmake/function-visibility-units.py then makes 22 wrapper units holding 178
source files, against 25 holding 141 on main (the nine units and 28 of their callees join, and three smaller groups
merge in). Those 28 would leave the /GL list for main's callers that have no entry (processUnitMove, exitLadder,
unitClimbing, UpdateHorseArcher_DoShooting and others).

Each caller-callee pair is measured as sourcehold#491's were: the unit's file compiled with the callee files pasted in front of
it, against the unit alone, quick_diff on main ff7e56e. The data resolvers were switched on with
tools/reimplementation-control/enable_reimplemented_data.py and the function resolver of every .cpp in the build list
with tools/reimplementation-helper/batch/enable_local_functions.py (locally, not committed). The callees tried are
the group's members that the unit calls directly or through another member it calls (so indirect ones too:
commitUnitLocation's two callees for UpdateTunneler, ConsiderHavingABreakNowUnk behind
UpdateWorker_ConsiderTakingABreakUnk for UpdateWheatFarmer), not callees reached only through functions outside the
group. A callee is listed when leaving it out of that set lowers the ratio; the listed set reads what the whole set
reads. quick_diff is stricter than reccmp about register names; the real builds read each unit at 100.0%.

- UpdateMother: 0.5668 alone, 0.9918 with its 3. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.7900,
  hasUnitReachedDestination 0.8918, changeDestinationByAmount 0.8994.
- UpdateChild: 0.5564 alone, 0.9993 with its 4. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.8294,
  hasUnitReachedDestination 0.9153, hasTunnelerNotFinishedDigging 0.9881, changeDestinationByAmount 0.9976.
- UpdateTunneler: 0.6433 alone, 0.9897 with its 2. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.7619,
  hasUnitReachedDestination 0.6726. commitUnitLocation and its callees setupUnitSharingCurrentTilePosition and
  setupUnitSharingTileIDs change nothing.
- UpdateWheatFarmer: 0.4115 alone, 0.9988 with its 8. Left out, IncrementAndOptionalUpdateAVValueRelated reads
  0.7775, ConsiderHavingABreakNowUnk 0.9838, SetStateToFreetimeWalking 0.9898, ComputeGoodsProduced 0.9784,
  checkIfCitizenUnitIsAliveBasedOnState 0.8193, hasUnitReachedDestination 0.9462, changeDestinationByAmount 0.9130,
  UpdateWorker_ConsiderTakingABreakUnk 0.9838.
- UpdateCrusaderArcher: 0.6723 alone, 0.9869 with its 3. Left out, xyAreValid reads 0.9709,
  hasUnitReachedDestination 0.7176, changeDestinationByAmount 0.9853.
- UpdateCrossbowman: 0.6537 alone, 0.9964 with hasUnitReachedDestination.
- UpdateLadderman: 0.4106 alone, 0.9938 with hasUnitReachedDestination.
- UpdateArabianArcher: 0.5843 alone, 0.9944 with hasUnitReachedDestination.
- UpdateFireThrower: 0.6844 alone, 0.9965 with hasUnitReachedDestination.
makeUnitStopWalkingByClearingPathProgressState, which UpdateMother, UpdateChild and UpdateWheatFarmer call, changes
nothing for any of them.

With every .cpp of main as the build list, cmake/function-visibility-units.py now makes 25 wrapper units holding
150 source files (141 before): the nine join the group that holds hasUnitReachedDestination, and no other file
changes group. CMake reads this file only with the option on, so the default build is unchanged.

Real builds of this change on main ff7e56e, BUILD_OK and 0 failures each:
- full, option on: every .cpp of main with all function and data resolvers on (the 12 files that don't compile since
  sourcehold#509's sync left out), 3,025 files and 3,043 functions, against main ff7e56e built the same way. The nine read
  100.0% / 100.0% (main: 37.7% to 65.7%); nothing else reads differently.
- small, both modes: main's /GL list, every .cpp that reads Unit::disappearFadeAlphaCountdown, the twelve units and
  UpdatePriest with their callee closures, and every file of a group that touches them, 485 files and 495 functions.
  All twelve read 100.0% / 100.0% in both modes; UpdatePriest, which has no entry, 100.0% off and 72.0% / 68.9% on,
  as on main.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
kotijekriv added a commit to kotijekriv/OpenSHC that referenced this pull request Dec 1, 2026
…er and UpdateSlave from gynt's units branch (100%, three with OPENSHC_FUNCTION_VISIBILITY_UNITS on) (sourcehold#537)

* reimplement: SHC_3BB0A8C1_0x0053C300 100.0% Reimplemented

Units::UpdateShield at 100%, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his commits on the
file: f791380 at 49.29%, cf15f54 at 52.39%, 6565c1b, 8ca7861 (the file again, whole) and the style commit
974c32f), through the forms on our development branches, where its history is (94.0% there, on main 1f87a13).

What the match needed, against the draft:

- The state it starts in is picked by an if / return pair, as in main's UpdateBatteringRam (sub / neg / sbb / and at
  0x0053C382); the draft had a ternary.
- Every access reads the unit through DAT_CurrentUnitSlotID::instance; the draft's local copy `int unitID` is gone.
- The scan for engineers tests its six conditions as six `if (...) { continue; }` statements, the counts are cleared
  with memset, the distances compare with the engineer first, and the tests read `> 16` and `< 1`, as the original
  compares. The tick test reads `^ 8` where the draft had `^ 0xfffffff8`, the same value under `& 15`.
- The AI check's loop and the two blocks that send the engineer to work are loops of one over manningEngineerRef and
  engineerIDs[9][1]: the first is a loop in the original too (0x0053C4C3), the others make it compute the unit's offset
  anew (0x0053C4D9, 0x0053C744), the start of a loop the compiler unrolled. Written out with index 0 (the first as a do
  / while (0), as its tests break out of it), they read 0.7650, 0.9848 and 0.9913 in quick_diff, against 0.9978.
- The search for the capturing owner is a for loop from 1 to 8 with a found flag, the source form that matches (the
  binary has no flag: the loop at 0x0053C6A7 returns at its end, 0x0053C6B4), and, the last step, it has a local of its
  own that is copied behind the capture, as in main's UpdateBatteringRam, where the parked text searched in the local
  that holds the shield's owner. With it the scan's bound stays in ebx (loaded at 0x0053C57F, compared at 0x0053C682):
  0.9859 -> 0.9978 in quick_diff with the /GL callees in the unit (the one line left, 0xffff against -0x1, is the same
  instruction). The bound read as the global itself instead of through a local came first (0.9827 -> 0.9859).
- createTribe gets the owner of units[searched], where searched is the counter the scan left behind (0x0053C70F); the
  draft passed the shield's own owner. The same call is in main's UpdateBatteringRam, and so is the next one:
  addUnitToTribe gets the tribe as unitID and the shield as tribeID (0x0053C736), with a fixme for each.

compiler-flags-gl.txt gets UpdateShield.cpp only: the two callees it has to see are on main's list already (quick_diff
0.5457 without hasUnitReachedDestination, 0.8707 without deselectUnit, 0.5152 without both).

On main, this round's text pass: main's name for state 108, BOOLEnum calls by truthiness, `++`, `const` on locals, the
fade countdown without its cast, UpdateBatteringRam's names and comments for the scan and its if / return pair for the
first state. The quick_diff listing is the same before and after it.

Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised), on
main 830fbd5: the small build of this branch's head (503 files, 513 functions: every /GL file of main, every .cpp
that reads Unit::disappearFadeAlphaCountdown, the five units, the fourteen of sourcehold#515, sourcehold#516, sourcehold#518 and sourcehold#533 and
UpdatePriest with their callee closures (UpdateSlave's without playVictory2BikFromPlayerToPlayer's, which doesn't link
in a small build), two callers of standUpIfSeated and every file of a function-visibility group that touches them),
once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. The full builds (3,041 files,
3,059 functions: every .cpp but main's three that don't compile, once off and once on) were made before the last text
edits; quick_diff gives the same listing of every file before and after them. It reads 100.0 / 100.0 in all of them.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x0054F860 96.3% 100.0 with OPENSHC_FUNCTION_VISIBILITY_UNITS on

Units::UpdateHunter, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his commits on the file:
76bb533 at 48.51%, 9f9546f at 52.15%, 8ca7861 (the file again, whole) and the style commit 974c32f),
through the forms on our development branches, where its history is (95.3% there). 100% with
OPENSHC_FUNCTION_VISIBILITY_UNITS on, with its entry in this branch's last commit; 96.3% in the default build, so the
status line carries that number, as UpdatePitchman's does.

What the match needed, against the draft:

- Every access reads the unit through DAT_CurrentUnitSlotID::instance; the draft's local copy `int unitID` is gone.
- The states are one if / else-if chain whose arms fall out of it, where the draft had a block per state that returns;
  the shooting state keeps its closing return.
- The shooting state has the "look for another deer, or go home" block once in the arrow part, behind a flag the arrow
  sets, and once behind it (0x0054FF45, 0x0054FF71). The draft had it twice in the arrow part. The flag, arrowFired, is
  the source form that matches: the binary has none, four tests jump to 0x0054FF45.
- The early exits go the original's way round: the other hunter's uid test, "the deer is gone" and "the deer is within
  20" first when chasing, the walk to the post with the failed setDestinationForUnit as the else arm.
- The substate set when the hunter gets back to his post is (mapTimeInTicks & 1) + 2 with no cast (0x00550529), and the
  two height sums of the shot have the terrain height first.

What the option is for: the original knows ten of its callees and treats two, updateBuildingSignpostCounter and
getResourceCountThatCanBeDeposited, as opaque (it reads the slot again behind them). Both are on main's /GL list, so the
default build sees their bodies: quick_diff reads 0.9857 with all /GL callees in the unit, 0.9991 with the ten only,
where the one line left, 0xff against -0x1, is the same instruction. With the option on the two are in other wrapper
units. compiler-flags-gl.txt gets UpdateHunter.cpp, as it has UpdatePitchman.cpp.

On main, this round's text pass: main's names (UnitState_Hunter) for the hunter's states 0 to 11 and 106, through
state.hunter (as main's UpdatePitchman and UpdateWheatFarmer do for theirs), and for the resting state
(USH_RESTING_7); 108 to 111, 113 and 121 keep the shared US_ names; DNE_UNKNOWN_2 and RT_MEAT; BOOLEnum calls by
truthiness, `++` / `--`, `const` on locals, the fade step stored as -2, no `(char)` on the frame tables and the fade
countdown, unused `using` lines dropped, and the local for the slot in front of commitUnitLocation dropped. The
quick_diff listing is the same before and after it.

Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised), on
main 830fbd5: the small build of this branch's head (503 files, 513 functions: every /GL file of main, every .cpp
that reads Unit::disappearFadeAlphaCountdown, the five units, the fourteen of sourcehold#515, sourcehold#516, sourcehold#518 and sourcehold#533 and
UpdatePriest with their callee closures (UpdateSlave's without playVictory2BikFromPlayerToPlayer's, which doesn't link
in a small build), two callers of standUpIfSeated and every file of a function-visibility group that touches them),
once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. The full builds (3,041 files,
3,059 functions: every .cpp but main's three that don't compile, once off and once on) were made before the last text
edits; quick_diff gives the same listing of every file before and after them. With the option on it reads 100.0 /
100.0, with it off 96.3 / 86.9.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00553AE0 94.6% 100.0 with OPENSHC_FUNCTION_VISIBILITY_UNITS on

Units::UpdateAppleFarmer, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his commits on the file:
69e0814 at 43.32%, 8ca7861 (the file again, whole) and the style commit 974c32f), through the forms on our
development branches, where its history is (94.1% there). 100% with OPENSHC_FUNCTION_VISIBILITY_UNITS on, with its
entry as this branch's last commit leaves it; 94.6% in the default build, so the status line carries that number, as
UpdatePitchman's does.

What the match needed, against the draft:

- The branches of four states the original's way round, read off it one basic block at a time: going to the workplace
  and waiting for a tree (the call that works first), the granary walk (its failure path written out), the deposit (one
  local for getResourceCountThatCanBeDeposited's result).
- The last steps: every access reads the unit through DAT_CurrentUnitSlotID::instance (our parked text still indexed
  some through the draft's `unitID` and one state through a local for the slot, across a setDestinationForUnit call,
  which is not a named callee and stays opaque), and the waiting state stores the slot into the orchard's workers[]
  before it reads the frame, as main's UpdateDairyFarmer does. In quick_diff with the group's callees in the unit
  0.9899 -> 0.9984 (the one line left, 0xff against -0x1, is the same instruction). Only together: 0.9844 without the
  second step, 0.9891 with the state's local kept.

What the option is for: the original reads the slot again behind getResourceCountThatCanBeDeposited, which is on main's
/GL list, so the default build sees its body and keeps the register (quick_diff 0.9820 with it, 0.9984 without).
compiler-flags-gl.txt gets UpdateAppleFarmer.cpp, as it has UpdatePitchman.cpp.

On main, this round's text pass: main's names for states 108 and 121 and for DNE_UNKNOWN_2, BOOLEnum calls by
truthiness, `++` / `--`, `const` on locals, no `(char)` on the frame tables and the fade countdown, the unused `using`
lines and one unused include dropped, USAF_WAITING_1 for the resting state and the farmer's own state type for the
local. The quick_diff listing is the same before and after it.

Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised), on
main 830fbd5: the small build of this branch's head (503 files, 513 functions: every /GL file of main, every .cpp
that reads Unit::disappearFadeAlphaCountdown, the five units, the fourteen of sourcehold#515, sourcehold#516, sourcehold#518 and sourcehold#533 and
UpdatePriest with their callee closures (UpdateSlave's without playVictory2BikFromPlayerToPlayer's, which doesn't link
in a small build), two callers of standUpIfSeated and every file of a function-visibility group that touches them),
once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. The full builds (3,041 files,
3,059 functions: every .cpp but main's three that don't compile, once off and once on) were made before the last text
edits; quick_diff gives the same listing of every file before and after them. With the option on it reads 100.0 /
100.0, with it off 94.6 / 89.6.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x0056E190 100.0% Reimplemented

Units::UpdateJester at 100%, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his commits on the
file: 146023d at 42.00%, 93b5ce0 at 50.14%, 8ca7861 (the file again, whole) and the style commit 974c32f),
through the forms on our development branches, where its history is (94.1% there).

What the match needed, against the draft:

- Every access reads the unit through DAT_CurrentUnitSlotID::instance; the draft's local copy `int unitID` is gone.
- The states are one if / else-if chain whose arms fall out of it, where the draft had a block per state that returns,
  and the first death state tests "the animation is over" first.
- gfxBase is declared at the function's top (with a comment): the original zeroes a register for it in the first block
  and keeps the owner in the frame (0x0056E1C7).
- The random roll is read once into an int local and compared twice (0x0056E336). The text stores the wandering state
  in two arms; the original has the store once (0x0056E3AF) and so has ours, the compiler merges the two arms (one arm
  for both cases loses the match: quick_diff 0.9950 and 0.9894 against 0.9986).
- The last steps, on this main: two locals our parked text had for the slot are gone, one around
  changeDestinationByAmount in the walk-up state and one in front of commitUnitLocation in the fade state. With the
  callees' bodies visible they cost (quick_diff with the /GL callees in the unit 0.9612 -> 0.9936 -> 0.9958). And the
  walk-up state tests `movementSpeed < 1`, a compare with the constant 1 the original holds in bp, where the draft had
  `<= 0`, the same values (0.9958 -> 0.9986; the one line left, 0xff against -0x1, is the same instruction).

compiler-flags-gl.txt gets UpdateJester.cpp only: the eight callees it has to see are on main's list already (quick_diff
without each: checkIfCitizenUnitIsAliveBasedOnState 0.8217, changeDestinationByAmount 0.8870,
hasUnitReachedDestination 0.9627, makeUnitStopWalkingByClearingPathProgressState 0.9859, hasTunnelerNotFinishedDigging
0.9944, commitUnitLocation, setupUnitSharingCurrentTilePosition and setupUnitSharingTileIDs 0.9958 each; 0.5465 without
any).

On main, this round's text pass: main's names for states 2, 3 and 108, BOOLEnum calls by truthiness, `++` / `--`,
`const` on locals, decimal constants, the fade step stored as -2, no `(char)` on the frame tables and the fade
countdown and no `(byte)` on the random number, unused `using` lines and one unused include dropped. The quick_diff
listing is the same before and after it.

Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised), on
main 830fbd5: the small build of this branch's head (503 files, 513 functions: every /GL file of main, every .cpp
that reads Unit::disappearFadeAlphaCountdown, the five units, the fourteen of sourcehold#515, sourcehold#516, sourcehold#518 and sourcehold#533 and
UpdatePriest with their callee closures (UpdateSlave's without playVictory2BikFromPlayerToPlayer's, which doesn't link
in a small build), two callers of standUpIfSeated and every file of a function-visibility group that touches them),
once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. The full builds (3,041 files,
3,059 functions: every .cpp but main's three that don't compile, once off and once on) were made before the last text
edits; quick_diff gives the same listing of every file before and after them. It reads 100.0 / 100.0 in all of them.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* reimplement: SHC_3BB0A8C1_0x00571C00 91.7% 100.0 with OPENSHC_FUNCTION_VISIBILITY_UNITS on

Units::UpdateSlave, from Gynt's draft on sourcehold's reimpl/map-units-updatefunctions (his commits on the file:
1f2f3bf at 43.44%, cfa098f at 49.88%, 6565c1b, 8ca7861 (the file again, whole) and the style commit
974c32f), through the forms on our development branches, where its history is (87.4% there). 100% with
OPENSHC_FUNCTION_VISIBILITY_UNITS on, with its entry as this branch's last commit leaves it; 91.7% in the default
build, so the status line carries that number, as UpdatePitchman's does.

What the match needed, against the draft:

- Every access reads the unit through DAT_CurrentUnitSlotID::instance; the draft's local copy `int unitID` is gone.
- The fill-moat branch counts the moat's countdown down first, then sets the targeting type, on every path (in the
  source, the path where setXYBasedOnMoatID returns 0 has the two the other way round, as main's UpdateEngineer does;
  the other order loses the match, quick_diff 0.9710 against 0.9792). The moving state tests "delay running" first; its
  moat branch and the digging walk go the original's way round.
- The last steps, on this main (quick_diff with the group's callees in the unit, each on the one before):
  - the parked text's local for the slot across changeDestinationByAmount is gone, the dig state's two frame arms are
    the other way round, and the unit on the dig tile is read once into a local, as in main's UpdatePikeman (0.9555 ->
    0.9654);
  - state 0 ends in a chain of three arms whose last two store the same state, as in main's UpdateEngineer: the
    original branches on 400 only (0x00571EFD), a two-way if / else and an early return for the 400 arm become a setcc
    instead (0.9683), and 0.9654 -> 0.9764 for the chain on the earlier text. The 96 of the middle arm is
    UpdateEngineer's number, by analogy; the original has no 96 here.
  - the moat's owner is read through a local for returnOwnedMoatAtTile's result (0.9764 -> 0.9792).
  What is left of the 0.9792 is how quick_diff spells constants, two-global sums and the timeGetTime import.
- `(int)` on the tick sum in front of `% 40`: the original divides signed (cdq, idiv), as in main's UpdatePikeman; the
  draft's remainder is unsigned, which differs once the sum passes 2^31.

What the option is for: getBuildingFlammabilityFactor is on main's /GL list, so the default build sees its body, and the
original treats it as opaque (quick_diff 0.9284 with it, 0.9792 without).
compiler-flags-gl.txt gets UpdateSlave.cpp, as it has UpdatePitchman.cpp.

On main, this round's text pass: main's names for states 2, 104, 105, 108 and 124 and for CD_UNSPECIFIED and L_MOAT,
BOOLEnum calls by truthiness, `++` / `--`, `const` on locals, no `(char)` on the frame tables and the fade countdown
and no `(short)` where main's UpdatePikeman has none, the string's text above its pointer, one unused include dropped,
CD_SOUTH for the rally's facing, an else-if and one else less around the two returns. The quick_diff listing is the
same before and after it. The compares with -1 (0.9693 with >= 0), the two closing stores of the dig state written on
both paths (0.9622 when written once), and the US_APPEAR stores of the sheet offset and the speed in both arms (0.9759
to 0.9782 hoisted) are measured, with comments in the text.

Measured with real builds (bundled MSVC1400-SP1, function and data resolvers on locally, reccmp raw / normalised), on
main 830fbd5: the small build of this branch's head (503 files, 513 functions: every /GL file of main, every .cpp
that reads Unit::disappearFadeAlphaCountdown, the five units, the fourteen of sourcehold#515, sourcehold#516, sourcehold#518 and sourcehold#533 and
UpdatePriest with their callee closures (UpdateSlave's without playVictory2BikFromPlayerToPlayer's, which doesn't link
in a small build), two callers of standUpIfSeated and every file of a function-visibility group that touches them),
once with OPENSHC_FUNCTION_VISIBILITY_UNITS off and once with it on, BUILD_OK both. The full builds (3,041 files,
3,059 functions: every .cpp but main's three that don't compile, once off and once on) were made before the last text
edits; quick_diff gives the same listing of every file before and after them. With the option on it reads 100.0 /
100.0, with it off 91.7 / 66.3.

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cmake: function-visibility.txt entries for UpdateShield, UpdateHunter, UpdateAppleFarmer, UpdateJester and UpdateSlave

New entries for UpdateShield, UpdateHunter and UpdateJester; UpdateAppleFarmer's and UpdateSlave's, which main had before
the files existed, each name two more callees. All name only callees that are already members of the group that holds
hasUnitReachedDestination, so the five units join that group's wrapper unit and nothing else moves: no other function
sees a body it didn't see before or loses one.

Each caller-callee pair is measured as sourcehold#491's were (quick_diff, the unit's file with the callee files pasted in front of
it, against the unit alone). The callees tried are the group's members that the unit calls directly or through another
member it calls; one is named when leaving it out lowers the ratio, and the named set reads what the whole set reads:

- UpdateShield 0.5152 alone, 0.9978 with its two: without hasUnitReachedDestination 0.5457, deselectUnit 0.8707.
- UpdateHunter 0.4887 alone, 0.9991 with its ten: without IncrementAndOptionalUpdateAVValueRelated 0.6953,
  checkIfCitizenUnitIsAliveBasedOnState 0.9004, hasUnitReachedDestination 0.9201, ComputeGoodsProduced 0.9840,
  SetStateToFreetimeWalking 0.9880, UpdateWorker_ConsiderTakingABreakUnk and ConsiderHavingABreakNowUnk 0.9907 each,
  commitUnitLocation, setupUnitSharingCurrentTilePosition and setupUnitSharingTileIDs 0.9929 each. Not named:
  makeUnitStopWalkingByClearingPathProgressState (no change).
- UpdateAppleFarmer 0.5793 alone, 0.9984 with its seven: without checkIfCitizenUnitIsAliveBasedOnState 0.8558,
  IncrementAndOptionalUpdateAVValueRelated 0.8580, ComputeGoodsProduced 0.8918, hasUnitReachedDestination 0.9408,
  SetStateToFreetimeWalking 0.9891; new in the entry, UpdateWorker_ConsiderTakingABreakUnk and
  ConsiderHavingABreakNowUnk, 0.9713 each. Not named: makeUnitStopWalkingByClearingPathProgressState (no change).
- UpdateJester 0.5465 alone, 0.9986 with its eight: the numbers are in its commit.
- UpdateSlave 0.5410 alone, 0.9792 with its three: without hasUnitReachedDestination 0.5245; new in the entry, xyAreValid
  0.9173 and changeDestinationByAmount 0.9764.

On top of the named callees, each /GL callee outside the group that the unit calls was tried one at a time, without its
own callees: only updateBuildingSignpostCounter (UpdateHunter 0.9933), getResourceCountThatCanBeDeposited (UpdateHunter
0.9915, UpdateAppleFarmer 0.9820) and getBuildingFlammabilityFactor (UpdateSlave 0.9284) change a ratio, and all lower it.

Full build of every file with the option on (3,041 files, 3,059 functions, BUILD_OK, 0 failures), against main
830fbd5's tree built the same way (3,036 files, 3,054 functions): nothing on main reads differently, and the five
units read 100.0 / 100.0. It was made before the last text edits of the five units; quick_diff gives the same listing
of every file before and after them. The generator makes 25 wrapper units holding 160 source files (155 on main): the
five units join the group that holds hasUnitReachedDestination, and no other file changes group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
gynt pushed a commit to gynt/OpenSHC that referenced this pull request Dec 2, 2026
…t and UpdateMiller (sourcehold#535)

sourcehold#534 gave the nine /GL units of sourcehold#515, sourcehold#516 and sourcehold#518 that had no entry in cmake/function-visibility.txt one, and left
three for a follow-up: UpdatePeasant and UpdateMiller (sourcehold#533), and UpdatePriest, main's own unit. This adds the three,
each at its address, its callees in address order. All three are on cmake/compiler-flags-gl.txt already (UpdatePriest
was there before those PRs); that file stays as it is. With OPENSHC_FUNCTION_VISIBILITY_UNITS on, the members of every
group leave the /GL list, among them the helpers in the group that holds hasUnitReachedDestination, so a /GL unit
without an entry no longer sees them: in main e62246a's full build in that mode, the build the real builds below
compare against, UpdatePriest reads 72.0% / 68.9%, UpdatePeasant 49.3% / 48.7% and UpdateMiller 51.7% / 46.2% (raw /
normalised: reccmp_report.py's normalised figure ignores call and tail-jump targets and resolver addresses).

UpdatePriest's entry names only callees that are already members of the group that holds hasUnitReachedDestination, as
sourcehold#534's do. UpdatePeasant's and UpdateMiller's name members of that group and, each, one more /GL callee that is not in
it: getDestination2EqualsGivenCoordinates for UpdatePeasant and standUpIfSeated for UpdateMiller. With the members
alone they read 96.0% / 87.1% and 96.5% / 93.0% in an earlier full build of this branch with the option on (below).
With that callee they read 100.0%, so it joins the group, and with the option on, CMake takes five more files off the
/GL list: the three units, getDestination2EqualsGivenCoordinates and standUpIfSeated. Nothing else moves:
getDestination2EqualsGivenCoordinates is called by UpdatePeasant only, and standUpIfSeated by UpdateMiller,
standUpAllTribeUnits and updatePeasantSeatingAtBuilding (neither of the last two is on the /GL list or has an entry, so
neither saw its body before or sees it now). No other function sees a body it did not see before. The three units'
other /GL callees (setDestinationForUnit, resetUnitMovementState, clearHiddenFlagAndUpdatePosition,
setWorkplaceBuildingEntryAsTarget, selectNewBlessingTarget, setUnitFacingDirectionTowardsTarget and the rest of their
closures) stay opaque to them.

Each caller-callee pair is measured as sourcehold#491's and sourcehold#534's were: the unit's file compiled with the callee files pasted in
front of it, against the unit alone, quick_diff on main e62246a, with the data resolvers switched on by
tools/reimplementation-control/enable_reimplemented_data.py and the function resolver of every .cpp in the build list
by tools/reimplementation-helper/batch/enable_local_functions.py (locally, not committed). The callees tried are the
group's members that the unit calls directly or through another member it calls (commitUnitLocation's callee
setupUnitSharingCurrentTilePosition and, behind it, setupUnitSharingTileIDs, included), not callees reached only
through functions outside the group; and, for UpdatePeasant and UpdateMiller, each /GL callee outside the group that
they call, one at a time on top of the named members, pasted without its own callees unless it says "with its callees".
A callee is listed when leaving it out of the set lowers the ratio; the listed set reads what the whole set reads.
quick_diff is stricter than reccmp about register names; the real builds read the units at 100.0%.

- UpdatePriest: 0.7534 alone, 0.9986 with its 5. Left out, makeUnitStopWalkingByClearingPathProgressState reads
  0.9891, IncrementAndOptionalUpdateAVValueRelated 0.8859, checkIfCitizenUnitIsAliveBasedOnState 0.9510,
  hasUnitReachedDestination 0.9680, changeDestinationByAmount 0.9850. commitUnitLocation, its callee
  setupUnitSharingCurrentTilePosition and, behind it, setupUnitSharingTileIDs change nothing.
- UpdatePeasant: 0.5329 alone, 0.9941 with its 3. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.5880,
  getDestination2EqualsGivenCoordinates 0.9725, hasUnitReachedDestination 0.9684. Outside the group, on top of the two
  members, clearHiddenFlagAndUpdatePosition (with its callees) and setDestinationForUnit change nothing.
- UpdateMiller: 0.5531 alone, 0.9973 with its 13. Left out, getBuildingResourceAmountByUid reads 0.9722,
  setupUnitSharingTileIDs 0.9947, standUpIfSeated 0.9913, sitDownIfStanding 0.9953,
  IncrementAndOptionalUpdateAVValueRelated 0.8442, ConsiderHavingABreakNowUnk 0.9914, SetStateToFreetimeWalking
  0.9707, ComputeGoodsProduced 0.9661, checkIfCitizenUnitIsAliveBasedOnState 0.8008, hasUnitReachedDestination 0.9593,
  setupUnitSharingCurrentTilePosition 0.9947, UpdateWorker_ConsiderTakingABreakUnk 0.9914, commitUnitLocation 0.9947.
  makeUnitStopWalkingByClearingPathProgressState changes nothing. Outside the group, on top of the twelve members,
  resetUnitMovementState (with its callees), setDestinationForUnit, setWorkplaceBuildingEntryAsTarget,
  addResourceToStockpile, buildingIsAccessible, updateBuildingSignpostCounter and
  getStorageBuildingForResourceTypeAndAmount change nothing; the last four are members of other groups, so with the
  option on they are off the /GL list already, and naming one would merge two groups.

With every .cpp of main as the build list, cmake/function-visibility-units.py makes 25 wrapper units holding 155
source files (150 before): the three units and the two callees join the group that holds hasUnitReachedDestination, and
no other file changes group. CMake reads this file only with the option on, so the default build is unchanged.

Real builds on main e62246a, BUILD_OK and 0 failures each:
- full, option on: every .cpp of main with all function and data resolvers on (the 3 files that don't compile there
  left out: findBestAttackTileByPathCost, resetTileAndClearMoat, TransformAndRenderPercentage), 3,036 files and 3,054
  functions, against main e62246a built the same way. Two full builds of the branch's side: one with the three
  entries without getDestination2EqualsGivenCoordinates and standUpIfSeated (UpdatePriest's as it is now), which reads
  UpdatePeasant 96.0% / 87.1%, UpdateMiller 96.5% / 93.0% and UpdatePriest 100.0% / 100.0%; and this change, which
  reads the three 100.0% / 100.0%. Against main nothing else reads differently in either.
- small, both modes: main's /GL list, every .cpp that reads Unit::disappearFadeAlphaCountdown, the twelve units of
  sourcehold#515, sourcehold#516 and sourcehold#518 (nine in sourcehold#534, three with an entry before it) and these three with their callee closures,
  standUpAllTribeUnits and updatePeasantSeatingAtBuilding, and every file of a group that touches them, 494 files and
  504 functions. All fifteen units read 100.0% / 100.0% in both modes. UpdateFireBallistaBuilding: with the option
  off, where this file is not read, 100.0% / 100.0% with the 494 files and 99.6% / 95.5% with 492 (without
  standUpAllTribeUnits and updatePeasantSeatingAtBuilding), so its reading changes with the set of files built; with
  the option on, 99.6% / 95.5% with the 494 files, and main was not built with those files and the option on, so that
  case is not settled. It reads 100.0% / 100.0% in both full builds, this change's and main's.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants